package com.orderplus.opshop.common.util;

import cn.hutool.core.codec.Base64;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * created by wangzelong 2019/1/8 10:34
 */
public class DateUtils {

	private final static String YYYYMMDD = "yyyyMMdd";

	/**
	 * 時間轉換
	 *
	 * @param date
	 * @return
	 */
	public static String parseDate(Date date) {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YYYYMMDD);
		return simpleDateFormat.format(date);
	}

	/**
	 * 生成1688数据查询接口的appkey
	 *
	 * @return
	 */
	public static String generateAppkey() {
		String str = "pc_tusou;" + System.currentTimeMillis();
		return Base64.encode(str.getBytes());
	}

	public static void main(String[] args) {
		System.out.println(generateAppkey());
	}
}
